<template>
    <div>
        <VueUeditorWrap  v-model="content" :config="config"></VueUeditorWrap>
        <el-button typeof="primary" @click="showContent()">子组件 Get UE Content (Alert)</el-button>
    </div>
</template>

<script>

import VueUeditorWrap from 'vue-ueditor-wrap'
import {getToken} from "@/utils/auth";
export default {
    name: "index",
    components: {
        VueUeditorWrap,
    },
    data() {
        return {
            config: {
                UEDITOR_HOME_URL: this.homeUrl,
                serverUrl:  this.uploadUrl,
                headers: {
                    Authorization: "Bearer " + getToken(),
                },
                // 编辑器不自动被内容撑高
                autoHeightEnabled: false,
                // 初始容器高度
                initialFrameHeight: this.height,
                // 初始容器宽度
                initialFrameWidth: '100%',
                lang:'zh-cn'
            },
        }
    },
    methods: {
        showContent() {
            alert(this.content);
        },
        getContent(){
            return this.content
        }
    },
    props: {
        content: {
            type: String,
            default: '<h2>Vue + UEditor + v-model双向绑定!+!$#</h2>'
        },
        height: {
            type: Number,
            default: 500
        },
        uploadUrl: {
            type: String,
            default: '/niua/admin/common/uploadUE'
        },
        homeUrl: {
            type: String,
            default: "/UEditor/"
        },
        lang: {
            type: String,
            default: 'zh-cn'
        }
    }
}

</script>

<style scoped>

</style>